package 设计模式.singleton;

/**
 * @Author: biubiu0002
 * @Date: 2021-07-11 22:29
 **/

//饿汉式单例 构造方法私有
public class Hungry {

    private String name = "hello Hungry Single";

    private Hungry(){

    }

    private final static Hungry HUNGRY = new Hungry();

    public static Hungry getInstance(){
        return HUNGRY;
    }

    public static void main(String[] args) {
        Hungry instance = getInstance();


    }

}
